#!/bin/sh

# Generate symlinks for acpid events, based on definitions in /etc/acpi.map
for i in $(awk '{if($NF && ($1 !~ /^#/)) print $NF}' /etc/acpi.map); do
        ln -s /etc/acpi/handler.sh /etc/acpi/$i
done

# Enable acpid
rc-update add acpid default

# Add /boot mount point in fstab
if [ -z "$(grep /boot /etc/fstab)" ]; then
        echo "/dev/dm-0 /boot   ext2    defaults        0       0" >> /etc/fstab
fi
# Add swap to fstab & enable swap on device startup
if [ -z "$(grep /dev/mmcblk1p3 /etc/fstab)" ]; then
        echo "/dev/mmcblk1p3    none    swap    defaults        0       0" >> /etc/fstab
fi
rc-update add swap default

exit 0
